package com.nbjtjc.safe.mapper.cost;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.nbjtjc.safe.model.cost.CostAccountReg;
import com.nbjtjc.safe.model.cost.CostInjuryClaim;
import com.nbjtjc.util.MyMapper;
@Mapper
public interface CostInjuryClaimMapper extends MyMapper<CostInjuryClaim> {
	@Update("UPDATE cost_injury_claim SET `total_claim`=(SELECT SUM(IFNULL(pay_sum,0)) FROM cost_injury_claim_record WHERE  cancel = 0 and injury_claim_id = #{id}) WHERE id=#{id}")
	int updateTotalClaim(@Param("id") int id);
	
	List<CostInjuryClaim> search(@Param("cic") CostInjuryClaim costInjuryClaim);
	
	List<CostInjuryClaim> searchDetail(@Param("cic") CostInjuryClaim costInjuryClaim);

	CostInjuryClaim show(@Param("id") int id);

	List<CostInjuryClaim> searchByYear(@Param("year") Date y,@Param("companyId") int companyId);
	
	List<CostInjuryClaim> searchDetailByYear(@Param("year") Date y,@Param("companyId") int companyId);


}
